//数据统计-体验列表
App.util.ns('Admin.Experience.Enter');
App.pages.add((function(){
    var NS = Admin.Experience.Enter;
    var page = new App.Page({
        name: 'experience/enter/index'
    });
    //页面初始化
    page.initStack.add('dataTable', function(){
        //面包屑导航
        this.setBreadcrumb([{
            icon: '<i class="fa fa-bar-chart-o"></i>',
            content: '数据统计'
        }, {
            content: '美文推荐'
        }]);
        this.dataTable = new App.DataTable({
            baseUrl: '/admin/experience/enter',
            dataUrl: 'lists',
            table: {
                id: 'id',
                main: 0,
                //showId: false,
                columns: App.util.copy(NS.Conf.columns)
            },
            filter: [
                {type: 'keywords'},
                {type: 'timeRange'}
            ],
            menu: [
                {parent: 'add', permission: 'op:admin.experience.enter.create'},
                {parent: 'view', permission: 'op:admin.experience.enter.detail'},
                {parent: 'edit', permission: 'op:admin.experience.enter.update'},
                {
                    type: 'inline',
                    name: '关联商品',
                    permission: 'gp:admin/experience/enter',
                    operation: function(dataTable, enter){
                        var win = dataTable.wins.get('relationgoods');
                        win.form.change({
                            id: enter.id,
                        });
                        win.show();
                    }
                },
                {parent: 'drop', permission: 'op:admin.experience.enter.delete'},
                {parent: 'multiDrop', permission: 'op:admin.experience.enter.multiDelete'},
                //{parent: 'oplog', permission: 'op:admin.experience.experience.getOpLogs'}
            ],
            detail: {
                form: {
                    items: App.util.copy(NS.Conf.form)
                }
            },
            dragSort:{
                permission: 'op:admin.experience.enter.sort',
                url:'sort',
                filed:'sort'
            },
            after: function(dataTable){
                dataTable.wins.add(new NS.Relationgoods(dataTable), 'relationgoods');
            }
        }, page);
        this.dataTable.fix(this.contentContainer);
        this.dataTable.loadData();
    });
    //页面刷新
    page.refreshStack.add('dataTable', function(){
        this.dataTable.loadData(true);
    });
    //页面销毁
    page.destroyStack.add('dataTable', function(){
        this.dataTable.destroy();
    });
    return page;
})());